package net.entelijan.cobean.examples.panels;

import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import net.entelijan.cobean.examples.util.ExamplesUtil;
import net.miginfocom.swing.MigLayout;

public class DefaultMultiselPanel extends JPanel {

	private static final long serialVersionUID = 1L;

	private JList leftList = new JList();

	private JList rightList = new JList();

	private JButton removeButton = ExamplesUtil
			.createIconButton("arrow-left.png");

	private JButton addButton = ExamplesUtil
			.createIconButton("arrow-right.png");;

	public DefaultMultiselPanel() {
		super();
		this.leftList.setName("DefaultMultiselPanel.leftList");
		this.rightList.setName("DefaultMultiselPanel.rightList");
		this.removeButton.setName("DefaultMultiselPanel.removeButton");
		this.addButton.setName("DefaultMultiselPanel.addButton");

		setLayout(new MigLayout("insets 0 0 0 0", "", ""));

		JScrollPane leftPane = new JScrollPane(this.leftList);
		add(leftPane, "w 10:max:max, h 10:max:max");

		JPanel buttonsPanel = new JPanel();
		buttonsPanel.setLayout(new MigLayout());
		buttonsPanel.add(addButton, "w 50!, wrap");
		buttonsPanel.add(removeButton, "w 50!");
		add(buttonsPanel);

		JScrollPane rightPane = new JScrollPane(this.rightList);
		add(rightPane, "w 10:max:max, h 10:max:max");

	}

	public JList getLeftList() {
		return leftList;
	}

	public JList getRightList() {
		return rightList;
	}

	public JButton getRemoveButton() {
		return removeButton;
	}

	public JButton getAddButton() {
		return addButton;
	}

}